<%@ page import="com.XiGuaXiaoMe.dao.DaoSc" %>
<%@ page import="com.XiGuaXiaoMe.entity.SedCou" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="com.XiGuaXiaoMe.entity.Users" %>
<%@ page import="com.XiGuaXiaoMe.entity.course" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">

    <script src="../JS/Timetables.min.js"></script>
    <link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">

    <link rel="stylesheet" href="../CSS/toPage.css">

    <link rel="stylesheet" href="../font_cqbiizu5og9/iconfont.css">
    <title>大学课表</title>
    <link rel="stylesheet" href="../CSS/课程表1.css" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../font_cqbiizu5og9/iconfont.css">
    <link rel="stylesheet" type="text/css" href="../CSS/mainpage.css" />
</head>
<body>
<iframe class="obj1" src="head.html" frameborder="0" width="1300px" height="90px" scrolling="no"></iframe>
<div class="shell" style=" background-color: #bb3e03;">
    <a href="userinformation.jsp" class="box" style="color: #faedcd;" ><i class="iconfont icon-liebiao"></i><span>个人信息</span></a>
    <a href="课程表1.jsp" class="box" style="color: #faedcd;"><i class="iconfont icon-cangku"></i><span> 查看课表</span></a>
    <a href="/MyWeb/Student/coursefind" class="box"style="color: #faedcd;"><i class="iconfont icon-zhuti_tiaosepan"></i><span>选课</span></a>
    <a href="coursescore.jsp" class="box"style="color: #faedcd;"><i class="iconfont icon-qianbao"></i><span>课程成绩</span></a>
    <a href="日历3.html" class="box" style="color: #faedcd;"><i class="iconfont icon-dunpaibaoxianrenzheng"></i><span>日历</span></a>
    <a href="#" class="box"style="color: #faedcd;"><i class="iconfont icon-dengchu" onclick="shut()"></i><span>退出系统</span></a>
</div>

<div id="coursesTable"></div>
<%
    Users user = null;
    if(session.getAttribute("user")==null){
        response.sendRedirect("/User_Add.jsp");
    }else {
        user = (Users) session.getAttribute("user");
    }

%>

<!--<button onclick="onChange()"
        style="background-color: #00a2ae; color: #fff; padding: 5px 10px; border-radius: 4px;border: none">
    切换课表
</button>-->
<script src="https://eqcn.ajz.miesnfu.com/wp-content/plugins/wp-3d-pony/live2dw/lib/L2Dwidget.min.js"></script>
<script>
    L2Dwidget.init({"display": { "superSample": 2, "width": 100, "height": 200, "position": "right", "hOffset": 0, "vOffset": 0},
        "mobile": {
            "show": true,
            "scale": 0.5
        },
        "react": {
            "opacityDefault": 1,
            "opacityOnHover": 1
        }

    });
</script>
<%
    DaoSc select = new DaoSc();
    Iterator<course> list = select.selectSc(user.getUserName3());
    course cou = null;
    String s[]=new String[60];
    for(int i=0;i<30;i++)
        s[i]="";
    while(list.hasNext()) {
        cou = list.next();
        /*a1 星期数 */
        int a1=Integer.parseInt(cou.getTime().substring(1,2));
        /*a2 第几节 */
        int a2=Integer.parseInt(cou.getTime().substring(3,4));
        int num=(a1-1)*6+a2-1;
         s[num]=cou.getName()+"@"+cou.getXuhao()+" "+cou.getPlace()+"  "+cou.getTeacher();
    }
%>
<script>
  var courseList = [
    ['<%= s[0] %>', '<%=s[0]%>', '<%=s[1]%>', '<%=s[1]%>', '<%=s[2]%>', '<%=s[2]%>', '<%=s[3]%>',
        '<%=s[3]%>', '<%=s[4]%>', '<%=s[4]%>', '<%=s[5]%>', '<%=s[5]%>'],
      ['<%= s[6] %>', '<%=s[6]%>', '<%=s[7]%>', '<%=s[7]%>', '<%=s[8]%>', '<%=s[8]%>', '<%=s[9]%>',
          '<%=s[9]%>', '<%=s[10]%>', '<%=s[10]%>', '<%=s[11]%>', '<%=s[11]%>'],
      ['<%= s[12] %>', '<%=s[12]%>', '<%=s[13]%>', '<%=s[13]%>', '<%=s[14]%>', '<%=s[14]%>', '<%=s[15]%>',
          '<%=s[15]%>', '<%=s[16]%>', '<%=s[16]%>', '<%=s[17]%>', '<%=s[17]%>'],
      ['<%= s[18] %>', '<%=s[18]%>', '<%=s[19]%>', '<%=s[19]%>', '<%=s[20]%>', '<%=s[20]%>', '<%=s[21]%>',
          '<%=s[21]%>', '<%=s[22]%>', '<%=s[22]%>', '<%=s[23]%>', '<%=s[23]%>'],
      ['<%= s[24] %>', '<%=s[24]%>', '<%=s[25]%>', '<%=s[25]%>', '<%=s[26]%>', '<%=s[26]%>', '<%=s[27]%>',
          '<%=s[27]%>', '<%=s[28]%>', '<%=s[28]%>', '<%=s[29]%>', '<%=s[29]%>']

  ];
  var week = window.innerWidth > 360 ? ['周一', '周二', '周三', '周四', '周五'] :
    ['一', '二', '三', '四', '五'];
  var day = new Date().getDay();
  var courseType = [
    [{index: '1', name: '8:30'}, 1],
    [{index: '2', name: '9:30'}, 1],
    [{index: '3', name: '10:30'}, 1],
    [{index: '4', name: '11:30'}, 1],
    [{index: '5', name: '12:30'}, 1],
    [{index: '6', name: '14:30'}, 1],
    [{index: '7', name: '15:30'}, 1],
    [{index: '8', name: '16:30'}, 1],
    [{index: '9', name: '17:30'}, 1],
    [{index: '10', name: '18:30'}, 1],
    [{index: '11', name: '19:30'}, 1],
    [{index: '12', name: '20:30'}, 1]
  ];
  // 实例化(初始化课表)
  var Timetable = new Timetables({
    el: '#coursesTable',
    timetables: courseList,
    week: week,
    timetableType: courseType,
    highlightWeek: day,
    gridOnClick: function (e) {
      alert(e.name + '  ' + e.week + ', 第' + e.index + '节课, 课长' + e.length + '节');
      console.log(e);
    },
    styles: {
      Gheight: 50
    }
  });



</script>

</body>
</html>
